package com.csweimei.rentmanagementtreasure.tenant.viewModel;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableField;
import androidx.databinding.ObservableList;

import com.chad.library.BR;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.http.entity.HouseListBean;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.tatarka.bindingcollectionadapter2.ItemBinding;

public class HouseInfoPVM extends MultiItemViewModel {
    public ObservableField<HouseListBean.DataDTO> bean = new ObservableField<>();

    public ObservableList<HouseInfoCVM> observableList = new ObservableArrayList<>();
    public ItemBinding<HouseInfoCVM> itemBinding = ItemBinding.of(BR.viewModel, R.layout.item_house_info_child);

    public HouseInfoPVM(@NonNull BaseViewModel viewModel, HouseListBean.DataDTO pBean) {
        super(viewModel);
        bean.set(pBean);

        for (HouseListBean.DataDTO.ArrDTO cBean:pBean.getArr()) {
            HouseInfoCVM houseInfoCVM = new HouseInfoCVM(viewModel,cBean);
            observableList.add(houseInfoCVM);
        }

    }
}
